package com.bjc.sdx;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.bjc.sdx.activity.Activity02;
import com.bjc.sdx.activity.Activity3;
import com.bjc.sdx.activity.ContentProviderActivity;
import com.bjc.sdx.activity.ContentProviderActivity2;
import com.bjc.sdx.activity.MainActivity2;
import com.bjc.sdx.activity.MyBBreceiverActivity2;
import com.bjc.sdx.activity.MyBRReceiverActivity;
import com.bjc.sdx.activity.ServiceActivity;
import com.bjc.sdx.activity.ServiceActivity_2;

public class MainActivity extends Activity implements OnClickListener {
    private final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button btn=(Button)findViewById(R.id.btn);
        btn.setOnClickListener(this);
        Log.i("MainActivity","onCreate()");

        Button button = findViewById(R.id.btn2);
        button.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.d(TAG, "onClick: ");
//                Intent intent=new Intent(MainActivity.this, ServiceActivity.class);
                // 启动监听WiFi动态的广播
                // Intent intent=new Intent(MainActivity.this, MyBRReceiverActivity.class);

                /*Intent intent=new Intent(MainActivity.this, MyBBreceiverActivity2.class);*/
                /*Intent intent=new Intent(MainActivity.this, MainActivity2.class);*/
                Intent i=new Intent(MainActivity.this, ContentProviderActivity.class);
                startActivity(i);
            }
        });
    }
    @Override
    protected void onStart() {
        super.onStart();
        Log.i("MainActivity","onStart()");
    }
    @Override
    protected void onRestart() {
        super.onRestart();
        Log.i("MainActivity","onRestart()");
    }
    @Override
    protected void onResume() {
        super.onResume();
        Log.i("MainActivity","onResume()");
    }
    @Override
    protected void onPause() {
        super.onPause();
        Log.i("MainActivity","onPause()");
    }
    @Override
    protected void onStop() {
        super.onStop();
        Log.i("MainActivity","onStop()");
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.i("MainActivity","onDestroy()");
    }

    public void click(){
        //创建一个Intent对象，通过该对象开启第2个Activity
        Intent intent=new Intent(this, Activity02.class);
        startActivity(intent);
    }

    @Override
    public void onClick(View arg0) {
        click();
    }
}